package com.starbucks.opencase.construct;

import com.starbucks.opencase.data.daCode;
import com.starbucks.opencase.function.funCode;
import jakarta.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
@Component
public class constructCode {
    @Autowired
    private funCode funCode;
    @PostConstruct
    public void testPastDue(){
        new Timer().schedule(new TimerTask() {
            @Override
            public void run() {
                for(String p: daCode.codes.keySet())
                    if(funCode.testPastDue(p))funCode.delete(p);
            }
        },new Date(),1000);
    }
}
